import request from '@/utils/request'

// 新增设备
export function addDeviceInfo(data) {
  return request({
    url: '/business/deviceInfo',
    method: 'post',
    data: data
  })
}

// 设备列表
export function deviceInfoList(query) {
  return request({
    url: '/business/deviceInfo/list',
    method: 'get',
    params: query
  })
}

// 设备格子列表
export function deviceBoxInfoList(query) {
  return request({
    url: '/business/deviceBoxInfo/list',
    method: 'get',
    params: query
  })
}

// 设备详情页统计
export function headStatistics(deviceId) {
  return request({
    url: `/business/deviceBoxInfo/headStatistics/${deviceId}`,
    method: 'get'
  })
}

// 首页统计列表
export function listDetails(query) {
  return request({
    url: `/business/deviceInfo/listDetails`,
    method: 'get',
    params: query
  })
}

// 首页统计
export function indexStatistics(deviceId) {
  return request({
    url: `/business/deviceInfo/indexStatistics?deviceId=${deviceId}`,
    method: 'get'
  })
}

// /business/batteryErrorInfo/deviceErr/{boxId}

export function deviceErr(boxId) {
  return request({
    url: `/business/batteryErrorInfo/deviceErr/${boxId}`,
    method: 'get'
  })
}

// 电池信息详情

export function batteryDetails(boxId) {
  return request({
    url: `/business/batteryInfo/batteryDetails/${boxId}`,
    method: 'get'
  })
}

// 查询设备信息主列表
export function listdeviceInfo(query) {
  return request({
    url: '/business/deviceInfo/list',
    method: 'get',
    params: query
  })
}

// 查询设备信息主详细
export function getdeviceInfo(id) {
  return request({
    url: '/business/deviceInfo/' + id,
    method: 'get'
  })
}

// 新增设备信息主
export function adddeviceInfo(data) {
  return request({
    url: '/business/deviceInfo',
    method: 'post',
    data: data
  })
}

// 修改设备信息主
export function updatedeviceInfo(data) {
  return request({
    url: '/business/deviceInfo',
    method: 'put',
    data: data
  })
}

// 删除设备信息主
export function deldeviceInfo(id) {
  return request({
    url: '/business/deviceInfo/' + id,
    method: 'delete'
  })
}

// 导出设备信息主
export function exportdeviceInfo(query) {
  return request({
    url: '/business/deviceInfo/export',
    method: 'get',
    params: query
  })
}

// 设备设置充满电量
export function setFullRatio(deviceId, fullRatio) {
  return request({
    url: `/business/deviceInfo/setFullRatio/${deviceId}/${fullRatio}`,
    method: 'get',
    timeout: 150000
  })
}
// 单个格子设置充满电量
export function setBoxFullRatio(boxId, fullRatio) {
  return request({
    url: `/business/deviceBoxInfo/setFullRatio/${boxId}/${fullRatio}`,
    method: 'get'
  })
}

// 

export function readFullRatio(boxId) {
  return request({
    url: `/business/deviceBoxInfo/readFullRatio/${boxId}`,
    method: 'get'
  })
}


// 

export function checkRedRatio(id) {
  return request({
    url: `/business/deviceBoxInfo/${id}`,
    method: 'get'
  })
}
